1 00:00:00,000 --> 00:00:14,240 This is Hacker Public Radio Episode 3,937 for Tuesday the 5th of September 2023. 2 00:00:14,240 --> 00:00:18,920 Today's show is entitled, Adventures in Py-Hole. 3 00:00:18,920 --> 00:00:24,360 It is the first show by new host noodles and is about 8 minutes long. 4 00:00:24,360 --> 00:00:26,960 It carries a clean flag. 5 00:00:26,960 --> 00:00:41,320 The summary is noodles recounts their experience getting a Py-Hole server. 6 00:00:41,320 --> 00:00:43,520 Hello listeners of Hacker Public Radio. 7 00:00:43,520 --> 00:00:48,600 I'm Nate, also known as Noodles, which is probably the name I'll put in the title as my host 8 00:00:48,600 --> 00:00:50,600 name. 9 00:00:50,600 --> 00:00:55,720 I know Hacker Public Radio is constantly asking for contributors, so I figured I'd 10 00:00:55,720 --> 00:00:58,760 start and contribute my own. 11 00:00:58,760 --> 00:01:03,080 I'm going to put this in the Emergency Q, so I figure not much of this will change 12 00:01:03,080 --> 00:01:09,240 over time, especially since it's just a recount of exactly what my experience in this was, 13 00:01:09,240 --> 00:01:11,880 but yeah, I hope you guys enjoy. 14 00:01:11,880 --> 00:01:17,720 So this is titled, Adventures in Py-Hole, and pretty much just in aftermath story, I've already 15 00:01:17,720 --> 00:01:22,400 done the setup for the Py-Hole, and I wrote it down after I set up the Py-Hole. 16 00:01:22,400 --> 00:01:27,240 So if I'm missing a few details, but you'll get the general list of how this went down. 17 00:01:27,240 --> 00:01:29,400 So what exactly is Py-Hole first off? 18 00:01:29,400 --> 00:01:35,480 Well, it's a DNS and DHCP server that allows for easy network side ad blocking along 19 00:01:35,480 --> 00:01:38,480 with the nice customizations of being that. 20 00:01:38,480 --> 00:01:44,400 A DNS server is kind of the server that you're a computer might ask, so if it asks, 21 00:01:44,400 --> 00:01:51,040 hey, what's google.com that DNS server will be churn the IP address of google.com. 22 00:01:51,040 --> 00:01:58,720 And a DHCP server is the server that gives out the IP addresses on your network. 23 00:01:58,720 --> 00:02:02,920 So the first step here is to actually get it running. 24 00:02:02,920 --> 00:02:08,440 And I did this using Docker Compose on my NAS, which even though I call it NAS, it's 25 00:02:08,440 --> 00:02:12,800 really my centralized server, that's just kind of what I call it. 26 00:02:12,800 --> 00:02:17,280 After a quick copy and paste from the Py-Hole's read me, I was pretty much up and running. 27 00:02:17,280 --> 00:02:22,240 I set up a singular system and use this as a DNS server and after that, I figured 28 00:02:22,240 --> 00:02:25,200 I was setting ready to go. 29 00:02:25,200 --> 00:02:27,040 But I wasn't quite satisfied there. 30 00:02:27,040 --> 00:02:31,200 I wanted automatic DNS setting for any device that connects to my network. 31 00:02:31,200 --> 00:02:33,560 Of course, I could just set the DNS upstream. 32 00:02:33,560 --> 00:02:41,680 I used open WRT router, so I could just set the DNS server in there, but not good enough 33 00:02:41,680 --> 00:02:42,680 for me. 34 00:02:42,680 --> 00:02:46,920 This means it'll be missing out on automatic per client information since when setting 35 00:02:46,920 --> 00:02:53,040 up a DNS server for your open WRT, it only sets itself to forward any DNS requests 36 00:02:53,040 --> 00:02:57,800 up to this DNS server, which means from Py-Hole's perspective, all the requests are coming 37 00:02:57,800 --> 00:03:02,680 from the router and nowhere else, and I wanted per client information. 38 00:03:02,680 --> 00:03:05,960 The solution here is to set up Py-Hole as a DHCP server. 39 00:03:05,960 --> 00:03:10,640 Keep in mind, I'm not giving it a tutorial or anything, so let's just go through what I 40 00:03:10,640 --> 00:03:12,360 did first. 41 00:03:12,360 --> 00:03:15,800 The first step was to turn on the DHCP server in Py-Hole. 42 00:03:15,800 --> 00:03:18,800 This was pretty easy, just a checkbox and click save. 43 00:03:18,800 --> 00:03:19,800 Awesome. 44 00:03:19,800 --> 00:03:26,640 I disabled the DHCP server in open WRT, and it was all set. 45 00:03:26,640 --> 00:03:31,920 A few restarting of some network devices later, like my phone and my laptop that I was using 46 00:03:31,920 --> 00:03:35,760 to set this up and they all automatically connected to the Py-Hole server, worked like 47 00:03:35,760 --> 00:03:40,000 a charm, they got IP addresses from it and everything else like that. 48 00:03:40,000 --> 00:03:42,120 Next up, I set up tail scale. 49 00:03:42,200 --> 00:03:46,760 I use head scale, which is kind of like the server side of tail scale, but one that you 50 00:03:46,760 --> 00:03:48,560 can host yourself. 51 00:03:48,560 --> 00:03:52,400 But the setup is pretty much exactly the same as if you were using tail scales, you 52 00:03:52,400 --> 00:03:53,400 why. 53 00:03:53,400 --> 00:03:59,200 I set in the config to override the local DNS, set the name server to the tail scale IP address 54 00:03:59,200 --> 00:04:02,200 of the server, and turn on magic DNS. 55 00:04:02,200 --> 00:04:03,680 Voila. 56 00:04:03,680 --> 00:04:08,480 Now to restarting the tail scale nodes, and make sure that on the server you set it not 57 00:04:08,480 --> 00:04:10,560 to accept the DNS from tail scale. 58 00:04:10,560 --> 00:04:14,320 If you don't do that, you'll get an endless loop of trying to use itself as a DNS 59 00:04:14,320 --> 00:04:15,320 server. 60 00:04:15,320 --> 00:04:16,320 It's just no good. 61 00:04:16,320 --> 00:04:17,320 All right. 62 00:04:17,320 --> 00:04:18,600 And after that, it's all set. 63 00:04:18,600 --> 00:04:21,760 I checked the dashboard and it's already blocking DNS requests. 64 00:04:21,760 --> 00:04:24,440 I can see all my tail scale devices in there. 65 00:04:24,440 --> 00:04:25,440 Perfect. 66 00:04:25,440 --> 00:04:26,440 Awesome. 67 00:04:26,440 --> 00:04:28,160 And I made a bit of a whip-sease. 68 00:04:28,160 --> 00:04:33,000 It was fine and great, but what I went to reboot my server, which I do weekly, something 69 00:04:33,000 --> 00:04:34,240 bad happened. 70 00:04:34,240 --> 00:04:36,560 The interface for the server didn't come up. 71 00:04:36,560 --> 00:04:41,800 The problem is that it's the DHCP server from a network, so without that networking, the 72 00:04:41,800 --> 00:04:43,320 network was dead in the water. 73 00:04:43,320 --> 00:04:44,960 It can't give out IP addresses. 74 00:04:44,960 --> 00:04:46,760 What's going on? 75 00:04:46,760 --> 00:04:50,900 I go ahead and access my server directly, no matter how hard I try, I cannot connect 76 00:04:50,900 --> 00:04:51,900 to the interface. 77 00:04:51,900 --> 00:04:52,900 What's the big deal? 78 00:04:52,900 --> 00:04:56,400 Well, this is actually pretty simple, and a question popped away ahead that got me 79 00:04:56,400 --> 00:04:57,400 there. 80 00:04:57,400 --> 00:05:00,560 How does the server even get its IP address? 81 00:05:00,560 --> 00:05:04,440 When I set up Python, it was just using the IP address that the router had given 82 00:05:04,440 --> 00:05:07,240 it earlier, which was more than happy to use. 83 00:05:07,240 --> 00:05:12,240 But the moment the router didn't have a DHCP server, the NAS had no way to get its own 84 00:05:12,240 --> 00:05:13,240 IP address. 85 00:05:13,240 --> 00:05:15,480 So, what's the answer here? 86 00:05:15,480 --> 00:05:17,400 Well, it's actually pretty simple. 87 00:05:17,400 --> 00:05:19,960 Just give the server a static IP. 88 00:05:19,960 --> 00:05:27,200 Make sure you set a static lease in the DHCP server of Python, and then I use network manager. 89 00:05:27,200 --> 00:05:34,360 You just set a quick static IP, and make sure it's DNS points to local host. 90 00:05:34,360 --> 00:05:36,160 And then everything is done. 91 00:05:36,160 --> 00:05:37,920 It worked like a charm. 92 00:05:37,920 --> 00:05:44,840 All right, crisis-averted, just a missing networking knowledge, happens to the best of us. 93 00:05:44,840 --> 00:05:47,240 So what's next up on the list? 94 00:05:47,240 --> 00:05:53,360 The default AdList is kind of small, let's go see if we could find some new AdLists. 95 00:05:53,360 --> 00:05:56,440 Apparently, this is a little bit more difficult than you'd think. 96 00:05:56,440 --> 00:06:01,560 A quick search on duck.go only came up with an equivalent search on GitHub. 97 00:06:01,560 --> 00:06:03,200 Not very useful. 98 00:06:03,200 --> 00:06:07,840 I have no idea the trustworthiness and stability of these AdLists. 99 00:06:07,840 --> 00:06:13,560 So another search leads to a Reddit article, and that leads to a different list. 100 00:06:13,560 --> 00:06:14,560 Awesome. 101 00:06:14,560 --> 00:06:16,080 An AdList list. 102 00:06:16,080 --> 00:06:21,200 This is FireballFireBog.net, and it's exactly what I needed. 103 00:06:21,200 --> 00:06:24,680 I went ahead and looked into these lists and added a few of them. 104 00:06:24,680 --> 00:06:25,680 Perfect. 105 00:06:25,680 --> 00:06:29,680 FireBog automatically sorts them by most stable to lease stable. 106 00:06:29,680 --> 00:06:34,080 So most likely it'll work versus a little bit more aggressive, but might break things 107 00:06:34,080 --> 00:06:35,800 in the process. 108 00:06:35,800 --> 00:06:38,960 All right, and the fifth step is maintenance. 109 00:06:38,960 --> 00:06:42,400 So what exactly do I do for maintenance of this server? 110 00:06:42,400 --> 00:06:47,680 Well, I used Docker Compose Pool, and then I used Docker Compose Up. 111 00:06:47,680 --> 00:06:50,760 Of course, this isn't always it. 112 00:06:50,760 --> 00:06:56,480 I use an AB update scheme, so I'll actually copy the container over to a different container, 113 00:06:56,480 --> 00:06:58,920 update that, run it, and if that doesn't work, 114 00:06:58,920 --> 00:07:04,080 I also, I still have that old container that I can go back to, but you still get the idea. 115 00:07:04,080 --> 00:07:09,600 Update your taken care of automatically by this, and just keep the server up as long as possible 116 00:07:09,600 --> 00:07:12,680 since this is what runs your DHCP server. 117 00:07:12,680 --> 00:07:16,840 I don't know, of course, I wasn't happy with just that. 118 00:07:16,840 --> 00:07:23,160 I wanted to move it off of my main NAS, there are a few reasons why I wanted to do that. 119 00:07:23,160 --> 00:07:28,120 For first, I liked having the magic DNS from tail scale on my server. 120 00:07:28,120 --> 00:07:32,800 I like being able to access my other computers using the server as kind of like a jump 121 00:07:32,800 --> 00:07:34,800 post. 122 00:07:34,800 --> 00:07:39,560 Number two, I wanted to have a computer that I can have on all the time. 123 00:07:39,560 --> 00:07:45,080 If I needed to update my server, it ends up taking down my whole network, so, or maybe 124 00:07:45,080 --> 00:07:50,120 some other problem happens with my server, and then I'm dead in the water for my network. 125 00:07:50,120 --> 00:07:53,480 And I don't like that dependency there. 126 00:07:53,480 --> 00:07:57,040 What I did was I ran it on a Raspberry Pi 3. 127 00:07:57,040 --> 00:08:00,520 I used Arch Linux ARM, which is what I already run on my NAS. 128 00:08:00,520 --> 00:08:02,720 I used Arch Linux on there. 129 00:08:02,720 --> 00:08:04,880 And then I just followed the same exact steps for that. 130 00:08:04,880 --> 00:08:10,600 I made sure that I set it as a static IP and just set it up on there, and it works wonderfully. 131 00:08:10,600 --> 00:08:15,360 I don't have to worry about whether, oh, I need to reboot my server because I changed 132 00:08:15,360 --> 00:08:17,320 this configuration file. 133 00:08:17,320 --> 00:08:19,240 I don't need to worry about that anymore. 134 00:08:19,240 --> 00:08:22,000 It's on a different computer now. 135 00:08:22,000 --> 00:08:25,000 So yeah, that's mainly my adventures in Pi Hope. 136 00:08:25,000 --> 00:08:29,160 I hope you guys enjoyed this pretty short recounting. 137 00:08:29,160 --> 00:08:35,160 And if you have any feedback or anything like that, I will have some contact information 138 00:08:35,160 --> 00:08:37,040 in the show notes. 139 00:08:37,040 --> 00:08:42,280 And I'll also have the original article that I wrote in the show notes as well. 140 00:08:42,280 --> 00:08:49,600 Thank you guys for listening and make sure you support hacker public radio, contribute yourself. 141 00:08:49,600 --> 00:08:54,520 And more importantly, just enjoy the content that it releases. 142 00:08:54,520 --> 00:09:00,400 Thank you guys for listening. 143 00:09:00,400 --> 00:09:05,480 You have been listening to hacker public radio at hacker public radio.org. 144 00:09:05,480 --> 00:09:09,520 Today's show was contributed by a HBR listening like yourself. 145 00:09:09,520 --> 00:09:15,880 If you ever thought of recording podcast, click on our contributally to find out how easy it 146 00:09:15,880 --> 00:09:16,880 means. 147 00:09:16,880 --> 00:09:22,560 Hosting for HBR has been kindly provided by an onsthost.com. 148 00:09:22,800 --> 00:09:25,580 Internet archive and our sing.net. 149 00:09:25,580 --> 00:09:30,480 On this advice stated, today's show is released on our Creative Commons. 150 00:09:30,480 --> 00:09:34,120 Attribution for.0. International license.